package com.fh.common.configs;
/*   配置类    相当于配置文件 */


import com.fh.common.interceptors.KuayuInterceptor;
import com.fh.common.interceptors.OutherInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;


@Configuration // 声明是一个配置类
public class KuayuConfigInterceptor extends WebMvcConfigurationSupport {
    @Autowired
    private KuayuInterceptor kuayuInterceptor;
    @Autowired
    private OutherInterceptor outherInterceptor;

    @Override
    protected void addInterceptors(InterceptorRegistry registry) {
        /*  注册跨域拦截器  */
       registry.addInterceptor(kuayuInterceptor).addPathPatterns("/**");

       /*注册一个 添加购物车 拦截器*/
        registry.addInterceptor(outherInterceptor).addPathPatterns("/auth*/**");
    }
}
